/*
 * @Author: nengwu 409791297@qq.com
 * @Date: 2020-06-29 18:05:20
 * @LastEditors: mylesshie@gmail.com
 * @LastEditTime: 2020-07-08 10:37:13
 * @description: 
 */ 
import React from 'react'
import { TouchableOpacity, View } from 'react-native'
import { Header } from 'react-native-elements'
import { useNavigation } from '@react-navigation/native'
import AntDesign from 'react-native-vector-icons/AntDesign'
import styles from './styles'

const backImg = require('@/assets/images/icon-back.png')

const Headers = props => {
  const navigation = useNavigation()
  const goBack = () => {
    navigation.pop()
  }

  const defaultPorps = {
    leftComponent: <TouchableOpacity onPress={() => goBack()}><View style={styles.leftCont}><AntDesign name="left" colr="#000" size={26} /></View></TouchableOpacity>,
    centerComponent: {
      text: props.title || 'app',
      style: {
        color: props.titleColor || '#000',
        fontSize: 18,
        fontWeight: '500'
      }
    },
    backgroundColor: '#fff'
  }
  const endProps = Object.assign({}, defaultPorps, props)
  return (
    <Header {...endProps} />
  )
}

export default Headers